package com.thrc.borrow.utils;

import java.net.URLEncoder;

public class SmsUtil {

	/**
	 * 发送短信
	 * 
	 * @param body
	 *            短信主体内容
	 * @param mobile
	 *            接收手机号
	 */
	public static String send(String mobile, String body) {
		String address = "apis.whkxdx.com";// 远程地址：不带http://
		int port = 80;// 远程端口
		String account = "thrc";// 账户
		String token = "520620";// pwd
		int userId = 909;// 用户Id
		KXTSmsSDK kxtsms = new KXTSmsSDK();
		kxtsms.init(address, port, account, token, userId);
		try {
			body = URLEncoder.encode("【天禾人才】" + body, "UTF-8");// URL编码 UTF-8方式
		} catch (Exception e) {

		}
		String result = kxtsms.send(mobile, body);
		System.out.println(result);
		return result;

	}

	public static void main(String[] args) {
		send("13554396431", "感谢您的注册，请勿向任何人提供验证码信息。验证码：1234");
	}
}
